import IsWeixinOrAlipay from "./IsWeixinOrAlipay.js"
import jwx from '@/common/jwx'
export default function(callback) {
	let promise;
	if (typeof callback !== "function") {
		promise = new Promise((resolve, reject) => {
			callback = function(resolvedata, rejectdata) {
				if (resolvedata) {
					resolve(resolvedata);
				} else {
					reject(rejectdata);
				}
			};
		});
	}
	if (IsWeixinOrAlipay() == "weixin") {
		jwx.sysscanQRCode();
	} else if (IsWeixinOrAlipay() == "zfb") {
		ap.scan(function(res) {
			if (res.code != "" && res.code) {
				let result = res.code;
				sysstr(result);
			}
		});
	} else {
		uni.showToast({
			title: uni.$z.$t('请在微信或支付宝中打开'),
			duration: 2000,
			icon: "none"
		});

	}
	return promise;
}